import os
from dotenv import load_dotenv

load_dotenv()

class Config:
    """Flask 应用配置类"""
    
    # 数据库配置
    DATABASE_PATH = os.getenv('DATABASE_PATH', 'knowledge_graph.db')
    
    # 确保数据库文件在应用目录下
    if not os.path.isabs(DATABASE_PATH):
        DATABASE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), DATABASE_PATH)
    
    # SQLAlchemy 配置
    SQLALCHEMY_DATABASE_URI = f'sqlite:///{DATABASE_PATH}'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    
    # Flask 配置
    SECRET_KEY = os.getenv('SECRET_KEY', 'your-secret-key-here')
    DEBUG = os.getenv('DEBUG', 'True').lower() == 'true'
